<template>
  <div>
    <div id="h">
      <criteria-paged :model="model">
        <criteria partial='criteria' @condition-changed='$parent.query' ref="criteria">
          <div novalidate class="form-inline auto" partial>
            <div class="form-group">
              <input type="text" class="form-control" v-model="model.f_userid" id="f_userid" placeholder="用户编号"
                     condition=" f_userid='%{}%'"
                     defaultvalue="'13'">
              <input type="text" class="form-control" v-model="model.f_username" id="f_username" placeholder="用户姓名"
                     condition=" f_username='%{}%'"
                     defaultvalue="'13'">
              <label for="startDate">开始日期:</label>
              <datepicker id="startDate" placeholder="开始日期"
                          v-model="model.startDate"
                          condition="f_check_date>=to_date('{} 00:00:00','yyyy-MM-dd hh24:mi:ss')"
                          :value.sync="model.startDate"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
              <label for="endDate">结束日期:</label>
              <datepicker id="endDate" placeholder="结束日期"
                          v-model="model.endDate"
                          condition="f_check_date<=to_date('{} 00:00:00','yyyy-MM-dd hh24:mi:ss')"
                          :value.sync="model.endDate"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
              <button class="btn btn-default" @click="search()">查询</button>
              <!--<export-excel :data="{startDate: this.model.startDate, endDate: this.model.endDate, userid: this.model.F_USERID, username: this.model.f_username}"-->
                            <!--:total="[{-->
               <!--1: '小计', 2: null, 3: null,-->
               <!--4: $parent.$parent.model.sums.f_pregas_all,-->
               <!--5: $parent.$parent.model.sums.f_preamount_all,-->
               <!--6: $parent.$parent.model.sums.f_pregas,-->
               <!--7: $parent.$parent.model.sums.f_preamount,-->
               <!--8: $parent.$parent.model.sums.f_grossproceeds,-->
               <!--9: $parent.$parent.model.sums.f_zhye}]"-->
                            <!--sqlurl="/rs/excel/report/gongye_fee/用户工业用气明细"></export-excel>-->
            </div>
          </div>
        </criteria>


          <data-grid :model="model" classname="reporttable" partial='list'>
            <template partial='head'>
              <tr>
                <th colspan='9' style="border: 1px solid white; border-bottom: 1px solid black; text-align: center;">
                  <h1 align="center">明细表</h1>
                </th>
              </tr>
              <tr>
                <th>序号</th>
                <th>用户编ID</th>
                <th>用户编号</th>
                <th>用户名称</th>
                <th>手机号</th>
              </tr>
            </template>
            <template partial='body'>
              <tr>
                <td style="text-align: center;">{{$index+1}}</td>
                <td style="text-align: center;">{{row.id}}</td>
                <td style="text-align: center;">{{row.f_userid}}</td>
                <td style="text-align: center;">{{row.f_username}}</td>
                <td style="text-align: center;">{{row.f_phone}}</td>
              </tr>
            </template>
            <!--<template partial='foot'>-->
              <!--<tr>-->
                <!--<td style="text-align: center;">小计</td>-->
                <!--<td style="text-align: center;"></td>-->
                <!--<td style="text-align: center;"></td>-->
                <!--<td style="text-align: center;">{{model.sums.f_pregas_all.toFixed(2)}}</td>-->
                <!--<td style="text-align: center;">{{model.sums.f_preamount_all.toFixed(2)}}</td>-->
                <!--<td style="text-align: center;">{{model.sums.f_pregas.toFixed(2)}}</td>-->
                <!--<td style="text-align: center;">{{model.sums.f_preamount.toFixed(2)}}</td>-->
                <!--<td style="text-align: center;">{{model.sums.f_grossproceeds.toFixed(2)}}</td>-->
                <!--<td style="text-align: center;">{{model.sums.f_zhye.toFixed(2)}}</td>-->
              <!--</tr>-->
            <!--</template>-->
          </data-grid>
      </criteria-paged>
    </div>
</template>
<script>
  import * as Util from '../Util'
  import { PagedList } from 'vue-client'

  export default {
      name: 'list',
      props: {
        total: String,
        condition: String,
        startdate: {
          type: String,
          default: Util.toStandardDateString()
        },
        enddate: {
          type: String,
          default: Util.toStandardDateString()
        }
      },
      // props: ['total', 'condition', 'startdate', 'enddate'],
      data () {
        return {
          model: new PagedList('rs/sql/detail', 10)
        }
      },
      methods: {
        query (param) {
          // console.log(param)
          this.condition += ' and ' + param.toString()
          this.$emit('condition-changed', param)
        },
        conditionChanged (condition) {
          this.condition = condition.condition
          console.log(condition)
          this.$emit('condition-changed', this.condition)
          // this.$refs.search.search(condition)
        },
        searchdata () {
          // this.$emit('total', this.total)
        }
      },
      ready () {
        // this.searchdata()
      },
      watch: {
      }
    }
</script>

